import request from '@/utils/request'
import formurlencoded from 'form-urlencoded'

//获取文章分类
export function fetchNewsTypeList(query) {
  return request({
    url: '/admin/system/newstype/list',
    method: 'get',
    params: query
  })
}
//新增文章分类
export function createNewsType(data) {
  return request({
    url: '/admin/system/newstype/create',
    method: 'post',
    data: formurlencoded(data)
  })
}
//跳转编辑文章分类
export function toUpdateNewsType(query) {
  return request({
    url: '/admin/system/newstype/edit',
    method: 'get',
    params: query
  })
}

//更新文章分类
export function updateNewsType(data) {
  return request({
    url: '/admin/system/newstype/update',
    method: 'post',
    data: formurlencoded(data)
  })
}
//删除文章分类
export function delNewsType(data) {
  return request({
    url: '/admin/system/newstype/del',
    method: 'post',
    data: formurlencoded(data)
  })
}


//获取合作伙伴
export function fetchNewsParterList(query) {
  return request({
    url: '/admin/system/newsParter/list',
    method: 'get',
    params: query
  })
}
//新增合作伙伴
export function createNewsParter(data) {
  return request({
    url: '/admin/system/newsParter/create',
    method: 'post',
    data: formurlencoded(data)
  })
}
//跳转编辑合作伙伴
export function toUpdateNewsParter(query) {
  return request({
    url: '/admin/system/newsParter/edit',
    method: 'get',
    params: query
  })
}

//更新合作伙伴
export function updateNewsParter(data) {
  return request({
    url: '/admin/system/newsParter/update',
    method: 'post',
    data: formurlencoded(data)
  })
}
//删除合作伙伴
export function delNewsParter(data) {
  return request({
    url: '/admin/system/newsParter/del',
    method: 'post',
    data: formurlencoded(data)
  })
}


//跳转获取文章
export function tofetchNewsList() {
  return request({
    url: '/admin/system/news',
    method: 'get'
  })
}

//获取文章
export function fetchNewsList(query) {
  return request({
    url: '/admin/system/news/list',
    method: 'get',
    params: query
  })
}

//跳转新增文章
export function tocreateNews() {
  return request({
    url: '/admin/system/news/add',
    method: 'get'
  })
}

//新增文章
export function createNews(data) {
  return request({
    url: '/admin/system/news/create',
    method: 'post',
    data: formurlencoded(data)
  })
}
//跳转编辑文章
export function toUpdateNews(query) {
  return request({
    url: '/admin/system/news/edit',
    method: 'get',
    params: query
  })
}

//更新文章
export function updateNews(data) {
  return request({
    url: '/admin/system/news/update',
    method: 'post',
    data: formurlencoded(data)
  })
}
//删除文章
export function delNews(data) {
  return request({
    url: '/admin/system/news/del',
    method: 'post',
    data: formurlencoded(data)
  })
}
